package org.stone.project.ncCheck.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.mail.MailProperties;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;
import org.stone.project.ncCheck.service.MsgSender;

@Component
public class MsgSenderImpl implements MsgSender {
    @Autowired
    private JavaMailSender javaMailSender;

    @Autowired
    private MailProperties mailProperties;

    @Override
    public void send(String content,String toUser){
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom(mailProperties.getUsername());
        message.setTo(toUser);
        message.setSubject("主题：服务器地址ip修改");
        message.setText(content);
        javaMailSender.send(message);
    }

}
